﻿@model Orion.Models.User

@{
    ViewBag.Title = "IRIS - Innranet - Breyta notanda " + Model.aspnet_User.UserName;
    Layout = "~/Views/Shared/_WorkLayout.cshtml";
}

<section id="main_content_wrapper">
<h1>Breyta Notendaupplýsingum</h1>

<script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Html.BeginForm("Edit", "Account", FormMethod.Post, new { enctype = "multipart/form-data" })) {
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Notandi @Model.aspnet_User.UserName</legend>

        @Html.HiddenFor(model => model.ID)

        @Html.HiddenFor(model => model.UserID)

        <div class="editor-label">
            @Html.LabelFor(model => model.SSN, "Kennitala")
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.SSN)
            @Html.ValidationMessageFor(model => model.SSN)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.FirstName, "Fyrranafn")
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.FirstName)
            @Html.ValidationMessageFor(model => model.FirstName)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.MiddleName, "Millinafn")
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.MiddleName)
            @Html.ValidationMessageFor(model => model.MiddleName)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.LastName, "Eftirnafn")
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.LastName)
            @Html.ValidationMessageFor(model => model.LastName)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.PostCode, "Póstnúmer")
        </div>
        <div class="editor-field">
            @Html.DropDownListFor(model => model.PostCode, Orion.Controllers.HomeController.GetAllPostCode())
            @Html.ValidationMessageFor(model => model.PostCode)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Address, "Heimilisfang")
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Address)
            @Html.ValidationMessageFor(model => model.Address)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.HomePhone, "Heimasími")
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.HomePhone)
            @Html.ValidationMessageFor(model => model.HomePhone)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.WorkPhone, "Vinnusími")
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.WorkPhone)
            @Html.ValidationMessageFor(model => model.WorkPhone)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.MobilePhone, "Farsími")
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.MobilePhone)
            @Html.ValidationMessageFor(model => model.MobilePhone)
        </div>


        <div class="editor-label">
            <img id="usr_img" src="@Model.Picture" alt="@Model.Picture" />
        </div>
       <div class="editor-label">
            @Html.LabelFor(model => model.Picture, "Mynd")
        </div>
        <div class="editor-field">
            <input type="file" name="file" id="file" />
        </div>

        @if(User.IsInRole("Admin") )
        {
            <div class="editor-label">
                @Html.LabelFor(model => model.Valid, "Virkur") 
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.Valid)
                @Html.ValidationMessageFor(model => model.Valid)
            </div>
            <div class="editor-label">
                @Html.LabelFor(model => model.Info, "Nánari lýsing")
            </div>
            <div class="editor-field">
                @Html.TextAreaFor(model => model.Info)
                @Html.ValidationMessageFor(model => model.Info)
            </div>
            <div class="editor-label">
                @Html.Label("Role", "Réttindi")
            </div>
            <div class="editor-field">
                <select id="role" name="role">
                    @if (Roles.IsUserInRole(@Model.aspnet_User.UserName, "Admin"))
                    {
                        <option selected="selected" value="Admin">Stjórnandi</option>
                        <option value="Staff">Starfsmaður</option>
                        <option value="General">Almennur</option>
                    }
                    else if (Roles.IsUserInRole(@Model.aspnet_User.UserName, "Staff"))
                    {
                        <option value="Admin">Stjórnandi</option>
                        <option selected="selected" value="Staff">Starfsmaður</option>
                        <option value="General">Almennur</option>
                    }
                    else
                    {
                        <option value="Admin">Stjórnandi</option>
                        <option value="Staff">Starfsmaður</option>
                        <option selected="selected" value="General">Almennur</option>
                    }
                </select>
            </div>
            
        }
        <p>
            <input type="submit" value="Vista" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>
</section>